Skip to content

Conversation

pamelafox
Copy link
Collaborator

@pamelafox pamelafox commented Aug 19, 2025

Purpose

This pull request updates the Python testing workflow to strengthen code coverage requirements and add a diff coverage check. The main changes focus on enforcing higher coverage standards and ensuring new code is adequately tested.

Testing and coverage improvements:

  • Increased the minimum required code coverage from 89% to 90% and added an XML coverage report output in the pytest command.
  • Added a new step to check diff coverage using diff-cover, comparing against the main branch and enforcing a minimum of 90% coverage for changed code.

Does this introduce a breaking change?

When developers merge from main and run the server, azd up, or azd deploy, will this produce an error?
If you're not sure, try it out on an old environment.

[ ] Yes
[X] No

Does this require changes to learn.microsoft.com docs?

This repository is referenced by this tutorial
which includes deployment, settings and usage instructions. If text or screenshot need to change in the tutorial,
check the box below and notify the tutorial author. A Microsoft employee can do this for you if you're an external contributor.

[ ] Yes
[X] No

Type of change

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[X] Other... Please describe: Testing

Code quality checklist

See CONTRIBUTING.md for more details.

  • The current tests all pass (python -m pytest).
  • I added tests that prove my fix is effective or that my feature works
  • I ran python -m pytest --cov to verify 100% coverage of added lines
  • I ran python -m mypy to check for type errors
  • I either used the pre-commit hooks or ran ruff and black manually on my code.

@pamelafox pamelafox requested a review from Copilot August 19, 2025 19:06
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR strengthens the testing workflow by adding diff coverage checks and updating development practices. The changes enforce higher code coverage standards while providing better tools for developers to verify test completeness.

  • Increased minimum code coverage requirement from 89% to 90% and added XML coverage report generation
  • Added diff coverage check using diff-cover tool to ensure new code has 90% coverage
  • Updated documentation to include new feature development guidelines and improved testing instructions

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
requirements-dev.txt Added diff_cover dependency for diff coverage analysis
CONTRIBUTING.md Enhanced testing documentation with new coverage commands and added feature development guidelines
.github/workflows/python-test.yaml Updated CI workflow to include diff coverage checks and XML report generation

- name: Run Python tests
if: runner.os != 'Windows'
run: pytest -s -vv --cov --cov-fail-under=89
run: pytest -s -vv --cov --cov-report=xml --cov-fail-under=89
Copy link
Preview

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The minimum coverage requirement is inconsistent. The pytest command still uses --cov-fail-under=89 while the diff-cover step enforces 90% coverage. This could cause confusion and inconsistent behavior.

Suggested change
run: pytest -s -vv --cov --cov-report=xml --cov-fail-under=89
run: pytest -s -vv --cov --cov-report=xml --cov-fail-under=90

Copilot uses AI. Check for mistakes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main branch doesnt yet have 90% coverage. It will in the upcoming multimodal PR. The two numbers can be different since one measures the total coverage and the other measures the coverage just of changed lines.

@pamelafox pamelafox merged commit d540a6e into Azure-Samples:main Aug 20, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants